#ifndef __UI__H
#define __UI__H

#define DEV_PATH "/sys/bus/iio/devices/iio:device0/in_voltage6_raw"
#define Light_PATH  "/sys/bus/iio/devices/iio:device2/in_illuminance_raw"
#define RED1 "/sys/class/gpio/gpio120/value"
#define RED2 "/sys/class/gpio/gpio121/value"
#define RED3 "/sys/class/gpio/gpio123/value"
#define RED4 "/sys/class/gpio/gpio124/value"
#define key_io_0 "/dev/input/event3"
#define key_io_1 "/dev/input/event0"

#include "../../lvgl/lvgl.h"
#include <stdio.h>
#include <stdbool.h>
#include <stdlib.h>
#include <time.h>
#include <fcntl.h>
#include <unistd.h>
#include <linux/input.h>

//屏幕函数
extern void Page();
extern void Page_1();
extern void Page_2();
extern void Page_3();
extern void Page_4();
extern lv_obj_t * ui_page;
extern lv_obj_t * ui_page1;
extern lv_obj_t * ui_page2;
extern lv_obj_t * ui_page3;
extern lv_obj_t * ui_page4;

//中文字符
extern void CN_Freetype( void );
extern lv_style_t style_32;
extern lv_style_t style_50;
extern lv_style_t style_32_bule;

//Page参数声明
extern FILE *fp;
extern lv_obj_t * ta_ID;
extern lv_obj_t * ta_Passwd;

//Page1参数声明
extern lv_obj_t * Home;
extern lv_obj_t * Sleep;
extern lv_obj_t * Windy;
extern lv_obj_t * Auto;

extern lv_obj_t * Switch1;
extern lv_obj_t * Switch2;
extern lv_obj_t * Switch3;
extern lv_obj_t * Switch4;

extern lv_obj_t * kongtiao_arc;
extern lv_obj_t * led_arc;
extern lv_obj_t * chuanglian_slider;

extern lv_obj_t * kongtiao_label;
extern lv_obj_t * led_label;
extern lv_obj_t * chuanglian_label;

extern lv_obj_t * temperature;
extern lv_obj_t * humidity;
extern lv_obj_t * light;

extern lv_obj_t * temperature_label;
extern lv_obj_t * humidity_label;
extern lv_obj_t * light_label;

extern int temperature_value;
extern int humidity_value;
extern int light_value;

//Page2参数声明
extern lv_obj_t * home_kongtiao;
extern lv_obj_t * home_led;
extern lv_obj_t * home_chuanglian;
extern lv_obj_t * home_jiashiqi;

extern lv_obj_t * sleep_kongtiao;
extern lv_obj_t * sleep_led;
extern lv_obj_t * sleep_chuanglian;
extern lv_obj_t * sleep_jiashiqi;

extern lv_obj_t * windy_kongtiao;
extern lv_obj_t * windy_led;
extern lv_obj_t * windy_chuanglian;
extern lv_obj_t * windy_jiashiqi;

extern lv_obj_t * home_kongtiao_txt;
extern lv_obj_t * home_LED_txt;
extern lv_obj_t * home_chuanglian_txt;

extern lv_obj_t * sleep_kongtiao_txt;
extern lv_obj_t * sleep_LED_txt;
extern lv_obj_t * sleep_chuanglian_txt;

extern lv_obj_t * windy_kongtiao_txt;
extern lv_obj_t * windy_LED_txt;
extern lv_obj_t * windy_chuanglian_txt;

extern int home_kongtiao_value;
extern int home_led_value;
extern int home_chuanglian_value;

extern int sleep_kongtiao_value;
extern int sleep_led_value;
extern int sleep_chuanglian_value;

extern int windy_kongtiao_value;
extern int windy_led_value;
extern int windy_chuanglian_value;

//Page3参数声明
extern lv_obj_t * Home_modify;
extern lv_obj_t * Sleep_modify;
extern lv_obj_t * Windy_modify;

//Page4参数声明
extern lv_obj_t * kongtiao_modify;
extern lv_obj_t * led_modify;
extern lv_obj_t * chuanglian_modify;
extern lv_obj_t * kb;
extern lv_obj_t * modify_value;

//回调函数(参数)声明
extern int Home_flag;
extern int Sleep_flag;
extern int Windy_flag;
extern int Auto_flag;
extern int Home_modify_flag;
extern int Sleep_modify_flag;
extern int Windy_modify_flag;
extern int kongtiao_modify_flag;
extern int led_modify_flag;
extern int chuanglian_modify_flag;
extern void arc_value_changed_event_cb(lv_event_t * e);
extern void slider_value_changed_event_cb(lv_event_t * e);
extern void switch_event_cb(lv_event_t * e);
extern void Switch_Fun();
extern void event_Home(lv_event_t * e);
extern void event_Sleep(lv_event_t * e);
extern void event_Windy(lv_event_t * e);
extern void event_Auto(lv_event_t * e);
extern void event_mode_modify(lv_event_t * e);
extern void event_value_modify(lv_event_t * e);
extern void ta_event_cb(lv_event_t * e);
extern void finishFun(lv_event_t * e);
extern int read_adc_key();

//开发板3568各类初始化函数
extern void led_init(void);
extern void fd_0_Fun(int fd_Red);
extern void fd_1_Fun(int fd_Red);
extern void keyInit();
extern void user_value_init();
extern void user_value_modify_init();
extern int adc_key_fd;
extern int io_key_fd;

#endif